package cn.lzy.RabbitMQ.config;

import org.springframework.amqp.core.*;
import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter;
import org.springframework.amqp.support.converter.MessageConverter;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Author: WeiKaiYe
 * @CreateTime: 2023-10-19  16:23
 */

/*
@Configuration
public class RabbitMQConfig {

    */
/**
     * 定制 JSON 格式的消息转换器
     * @return
     *//*


    // 自定义消息转换器
    @Bean
    public MessageConverter messageConverter(){
        return new Jackson2JsonMessageConverter();
    }


   */
/* // 1.定义 fanout 类型的交换器
    @Bean
    public Exchange fanout_exchange(){
        return ExchangeBuilder.fanoutExchange("fanout_exchange").build();
    }

    // 2.定义三个不同名称的消息队列
    @Bean
    public Queue fanout_queue_qq(){
        return new Queue("fanout_queue_qq");
    }
    @Bean
    public Queue fanout_queue_wechat(){
        return new Queue("fanout_queue_wechat");
    }
    @Bean
    public Queue fanout_queue_email(){
        return new Queue("fanout_queue_email");
    }

    // 3.将三个不同名称的消息队列与交换器进行绑定
    @Bean
    public Binding bindingQq(){
        return
                BindingBuilder.bind(fanout_queue_qq()).to(fanout_exchange()).with("").noargs();
    }
    @Bean
    public Binding bindingWechat(){
        return
                BindingBuilder.bind(fanout_queue_wechat()).to(fanout_exchange()).with("").noargs();
    }
    @Bean
    public Binding bindingEmail(){
        return
                BindingBuilder.bind(fanout_queue_email()).to(fanout_exchange()).with("").noargs();
    }*//*


}
*/
